package com.ygqh.baby.po;

import com.ygqh.baby.ao.OrderDetailStatus;
import com.ygqh.baby.ao.PromotionType;
import com.ygqh.baby.ao.RefundStatus;

import java.math.BigDecimal;

public class YgOrderDetail implements Cloneable {
    private Long id;

    private Long orderId;

    private String outCode;

    private Long skuId;

    private String skuCode;

    private Long supplierId;

    private String productName;

    private String shortName;

    private BigDecimal salePrice;

    private String size;

    private String imageUrl;

    private Long quantity;

    private String unitName;

    private OrderDetailStatus detailStatus;

    private RefundStatus refundStatus;

    private String sendMark;

    private PromotionType promotionType;

    private String remark;

    private BigDecimal foreverRate;

    private BigDecimal shareRate;


    private Long productId;

    private String productCode;

    private BigDecimal yhqDisPrice;

    private BigDecimal mjDisPrice;

    private BigDecimal bmDisPrice;

    private BigDecimal accountPrice;

    private BigDecimal expressPrice;

    private BigDecimal packDisPrice;

    private String promotionRemark;

    private BigDecimal vipDisPrice;

    private BigDecimal costPrice;

    private BigDecimal newCustomDisPrice;

    private BigDecimal realPrice;
    // =========================
    // 商品分摊优惠后金额
    private BigDecimal orderSharePrice;

    private Long returnQuantity;

    private String supplierName;

    private String outProductCode;
    private String outSkuCode;


    public String getOutCode() {
        return outCode;
    }

    public void setOutCode(String outCode) {
        this.outCode = outCode;
    }

    public String getOutProductCode() {
        return outProductCode;
    }

    public void setOutProductCode(String outProductCode) {
        this.outProductCode = outProductCode;
    }

    public String getOutSkuCode() {
        return outSkuCode;
    }

    public void setOutSkuCode(String outSkuCode) {
        this.outSkuCode = outSkuCode;
    }

    public BigDecimal getReturnSharePrice() {
        if (this.quantity == null || this.returnQuantity == null || orderSharePrice == null) {
            return new BigDecimal("0.00");
        }
        BigDecimal price = orderSharePrice;
        if (returnQuantity.compareTo(quantity) >= 0) {
            return price;
        } else {
            return orderSharePrice.divide(new BigDecimal(quantity), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(returnQuantity));
        }

    }

    public Long getReturnQuantity() {
        return returnQuantity;
    }

    public void setReturnQuantity(Long returnQuantity) {
        this.returnQuantity = returnQuantity;
    }

    public BigDecimal getOrderSharePrice() {
        return orderSharePrice;
    }

    public void setOrderSharePrice(BigDecimal orderSharePrice) {
        this.orderSharePrice = orderSharePrice;
    }

    public BigDecimal getForeverRate() {
        return foreverRate;
    }

    public void setForeverRate(BigDecimal foreverRate) {
        this.foreverRate = foreverRate;
    }

    public BigDecimal getShareRate() {
        return shareRate;
    }

    public void setShareRate(BigDecimal shareRate) {
        this.shareRate = shareRate;
    }

    public RefundStatus getRefundStatus() {
        return refundStatus;
    }

    public void setRefundStatus(RefundStatus refundStatus) {
        this.refundStatus = refundStatus;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public OrderDetailStatus getDetailStatus() {
        return detailStatus;
    }

    public void setDetailStatus(OrderDetailStatus detailStatus) {
        this.detailStatus = detailStatus;
    }

    public String getSendMark() {
        return sendMark;
    }

    public void setSendMark(String sendMark) {
        this.sendMark = sendMark;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode == null ? null : skuCode.trim();
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName == null ? null : productName.trim();
    }

    public BigDecimal getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size == null ? null : size.trim();
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl == null ? null : imageUrl.trim();
    }

    public Long getQuantity() {
        return quantity;
    }

    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }

    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName == null ? null : unitName.trim();
    }

    public PromotionType getPromotionType() {
        return promotionType;
    }

    public void setPromotionType(PromotionType promotionType) {
        this.promotionType = promotionType == null ? null : promotionType;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    @Override
    public YgOrderDetail clone() {
        YgOrderDetail detail = null;
        try {
            detail = (YgOrderDetail) super.clone(); // 浅复制
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return detail;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public BigDecimal getYhqDisPrice() {
        return yhqDisPrice;
    }

    public void setYhqDisPrice(BigDecimal yhqDisPrice) {
        this.yhqDisPrice = yhqDisPrice;
    }

    public BigDecimal getMjDisPrice() {
        return mjDisPrice;
    }

    public void setMjDisPrice(BigDecimal mjDisPrice) {
        this.mjDisPrice = mjDisPrice;
    }

    public BigDecimal getBmDisPrice() {
        return bmDisPrice;
    }

    public void setBmDisPrice(BigDecimal bmDisPrice) {
        this.bmDisPrice = bmDisPrice;
    }

    public BigDecimal getAccountPrice() {
        return accountPrice;
    }

    public void setAccountPrice(BigDecimal accountPrice) {
        this.accountPrice = accountPrice;
    }

    public BigDecimal getExpressPrice() {
        return expressPrice;
    }

    public void setExpressPrice(BigDecimal expressPrice) {
        this.expressPrice = expressPrice;
    }

    public BigDecimal getPackDisPrice() {
        return packDisPrice;
    }

    public void setPackDisPrice(BigDecimal packDisPrice) {
        this.packDisPrice = packDisPrice;
    }

    public String getPromotionRemark() {
        return promotionRemark;
    }

    public void setPromotionRemark(String promotionRemark) {
        this.promotionRemark = promotionRemark;
    }

    public BigDecimal getVipDisPrice() {
        return vipDisPrice;
    }

    public void setVipDisPrice(BigDecimal vipDisPrice) {
        this.vipDisPrice = vipDisPrice;
    }

    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice;
    }

    public BigDecimal getNewCustomDisPrice() {
        return newCustomDisPrice;
    }

    public void setNewCustomDisPrice(BigDecimal newCustomDisPrice) {
        this.newCustomDisPrice = newCustomDisPrice;
    }

    public BigDecimal getRealPrice() {
        return realPrice;
    }

    public void setRealPrice(BigDecimal realPrice) {
        this.realPrice = realPrice;
    }

    @Override
    public String toString() {
        return "YgOrderDetail [id=" + id + ", orderId=" + orderId + ", skuId=" + skuId + ", skuCode=" + skuCode + ", supplierId=" + supplierId
                + ", productName=" + productName + ", shortName=" + shortName + ", salePrice=" + salePrice + ", size=" + size + ", imageUrl=" + imageUrl
                + ", quantity=" + quantity + ", unitName=" + unitName + ", promotionType=" + promotionType + "]";
    }

}